Legato Resource Editing

‘ResEdit’ Setup Instructions

Draft #1 (05/02/14 02:54 PM)

 

 

 

Overview

Creating and editing dialogs can be arduous without some sort of GUI (Graphical User Interface), particularly when it comes to the visual aspects of design. There are a number of options for editing dialog resources. This document discusses using a product called “ResEdit”, which is free (please provide a donation if you like it).

Principally, ResEdit reads in your resource code and then allows the dialogs to be visually edited and then resaved as resource code. With that ability comes some restrictions and usage issues. For example, ResEdit requires an SDK header file to define certain windows codes for control styles. In addition, ResEdit requires that your definitions for control IDs be placed in a single file that generally has to be named the same thing for each project.

This document provides the basics on how to set up and use ResEdit. It is not an endorsement of the product nor do we support it. If you have comments or additions, please send it to support@novaworkssoftware.com and we will examine updating our documentation and Legato to the extent practical to meet your needs.

Installing ResEdit

Downloading and Installation

Go to www.resedit.net and download the 32- or 64-bit image. ResEdit 1.6x does not come with a traditional installer so if you want shortcuts and desktop links, you will have to create them. Unzip the contents to ‘Program Files’ (or ‘Program Files x86’ for mixed 64/32 bits or whatever location is appropriate). Then add shortcuts as desired. ResEdit has an XML profile and other features that have not been explored and are beyond the scope of this document.

Configure the Application Settings

A number of settings must be changed with the configuration fmenu. To access the configuration, go to Options | Preferences (Ctrl+P). The changes are as follows:

1.  Set the ‘Include Paths’ to the SDK for Legato.

     The filename and path can be easily retrieved by locating the file ‘ResourceSDK.h’ in the program files folder under Templates\Scripts within Windows Explorer, going to the address bar, and copying the path. Paste into the above dialog (remove the quotes) and then press Add.

2.  Change the ‘Code Generation’ by disabling ‘General LANGUAGE statements’.

3.  Change the ‘Header filename’ as desired. This file will also be included in your Legato script file for control IDs. You can use any acceptable filename, but it must be used for all projects. (A file of the same name will be located in different paths for each project.)

.

4.  Change the Resource script template as below.

     Copy text from here:

#ifndef LEGATO
#include <ResourceSDK.h>
#endif
#include "%RESOURCE_HEADER%"

%RESOURCES%

     Note that failing to add ‘%RESOURCES%’ will result in no meaningful data being written on save without warning.

     The ‘ifndef’ directive keeps Legato from reloading the SDK. If another SDK is used, this should also be wrapped with an if statement. 

Using ResEdit

Getting Started

Open the application and create an .rc project. You can use the wizard or manually create the project. Create a simple dialog as follows:

 

Once the project has been saved, you should have two files that look something like this:

Resource Header — dialog_ids.h :

#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif

#define IDD_DIALOG1                             100
#define IDD_EDIT_THIS                           40002

Resource File — My Simple Project.rc :

// Generated by ResEdit 1.6.2
// Copyright (C) 2006-2014
// http://www.resedit.net

#ifndef LEGATO
#include <ResourceSDK.h>
#endif
#include "dialog_ids.h"

//
// Dialog resources
//
IDD_DIALOG1 DIALOG 0, 0, 186, 48
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "Ms Shell Dlg"
{
    LTEXT           "Edit This!", -1, 7, 11, 30, 8, SS_LEFT, WS_EX_LEFT
    EDITTEXT        IDD_EDIT_THIS, 48, 8, 69, 14, ES_AUTOHSCROLL, WS_EX_LEFT
    PUSHBUTTON      "Cancel", IDCANCEL, 129, 24, 50, 14, 0, WS_EX_LEFT
    DEFPUSHBUTTON   "OK", IDOK, 129, 7, 50, 14, 0, WS_EX_LEFT
}

A Legato script can be created in the same folder. Name it as appropriate:

Legato Script — My Simple Project.ls :

#include "My Simple Project.rc"

DialogBox(IDD_DIALOG1);

Run the script ( F7 ) and the following should appear: 

This example does not contain any dialog procedures and effectively does nothing but display the dialog. But it is a starting point to demonstrate the creation and editing of a dialog. See the Legato Reference Manual chapter on Dialogs for more information.

The above resource header and file can be manually edited. However, use caution since ResEdit will replace the top section of the .rc file and will reorganize the .h file. It is generally easier to edit the control IDs and certain other information in the code view editor and use ResEdit (ot something else) to perform the visual positioning of controls. 

Finally, if errors are returned within the .h or .rc files within Legato, ResEdit will also probably not reopen the project.

Limitations

ResEdit will allow the editing of a number of resource types such as bitmaps, menus, strings, etc. At present only DIALOG and DIALOGEX are supported by Legato.

Within dialogs, only a subset of common controls are supported. Our development staff has not refined more exotic controls such as datetime. Further, ResEdit will create such resource data but does not apparently read it correctly.

Editing

Use caution when opening files and editing within ResEdit while having them open in the application. ResEdit does not perform share lock testing and if both files are edited simultaneously, data will be lost. It is recommended that the .rc and .h files be closed within the Legato IDE while editing in ResEdit.

* * * * *